package com.order.enums;

public enum OrderStatus {
    // 订单状态 1:待支付 2:已支付 3:已完成 4:已取消 5:已关闭 6:退款中 7:已退款
    WAIT_PAY((byte) 1, "待支付"),
    PAID((byte) 2, "已支付"),
    COMPLETED((byte) 3, "已完成"),
    CANCELED((byte) 4, "已取消"),
    CLOSED((byte) 5, "已关闭"),
    REFUNDING((byte) 6, "退款中"),
    REFUNDED((byte) 7, "已退款");
    private byte code;
    private String message;

    OrderStatus(byte code, String message) {
        this.code = code;
        this.message = message;
    }

    public byte getCode() {
        return code;
    }

    public static boolean isPaymentSuccess(Byte status) {
        return PAID.getCode() == status || COMPLETED.getCode() == status;
    }
    public static boolean isRefund(Byte status){
        return REFUNDING.getCode() == status || REFUNDED.getCode() == status;
    }
}
